package service

import (
	"github.com/gin-gonic/gin"
	"gorm.io/gorm"
	"seat-service/model"
	"seat-service/model/dto"
	"time"
)

type Reserve interface {
	GetDuration(sid uint, seatId uint, t int) bool                // 学生某个座位预约时长是否超出范围
	ReserveCount(reserve *model.Reserve) (count int64, err error) // 获取该位置预约记录
	GetClash(sid uint, start time.Time, end time.Time) (reserves []model.Reserve, err error)
	QueryClashByTime(par model.Reserve, time time.Time) (reserve []model.Reserve, err error)
	Update(par model.Reserve) (err error)
	SignIn(par *dto.SignInParam) (err error)
	Get(id uint) (reserves []model.Reserve, err error)
	Query(par model.Reserve) (reserve []model.Reserve, err error)
	GetByReserve(reserve *model.Reserve) (err error)
	Save(reserve *model.Reserve) (err error)
	CreateWithTransaction(tx *gorm.DB, reserve *model.Reserve) (err error)
	GetByReserveParam(par *dto.ParamReserve) (reserves []model.Reserve, err error)
	SaveRedisReserve(context *gin.Context, id uint, nowTime time.Time) (err error)          //Redis数据库存储预约记录
	DeleteRedisReserve(context *gin.Context, id int, uuid string) (err error, isExist bool) //签到成功 , 删除Redis数据库中的预约记录
	CheckStudentStatus(id uint) (student model.Student, err error)                          //检查学生的状态,判断学生能否预约,并且对封禁时间已过的用户解除封禁状态
}
